﻿using System;

class CheckBitAtPositionP
{
    static void Main()
    {
        int number;
        int bitPositionP;

        Console.WriteLine("Type a number:");
        bool isNumberValid = int.TryParse(Console.ReadLine(), out number);
        Console.WriteLine("Type position p:");
        bool isBitPositionPValid = int.TryParse(Console.ReadLine(), out bitPositionP);

        bool isBitAtPositionPOne;

        if (isNumberValid && isBitPositionPValid)
        {
            int bitAtPositionP = (number >> bitPositionP) % 2;

            if (bitAtPositionP == 1)
            {
                isBitAtPositionPOne = true;
            }
            else
            {
                isBitAtPositionPOne = false;
            }

        Console.WriteLine("It is {0} that the bit at position {1} is 1",isBitAtPositionPOne,bitPositionP);

        }
        else
        {
            Console.WriteLine("Your input isn`t OK!!!");
        }
    }
}